﻿@{
    ViewBag.Title = "ChooseUser";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
  <link rel="stylesheet" href="~/Content/themes/smoothness/jquery-ui.css" />
  <script src="~/Scripts/jquery-1.9.1.js"></script>
  <script src="~/Scripts/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css" />



  <script>
      $(function () {
          $("#txtDateFrom").datepicker();
          $("#txtDateTo").datepicker();

      });
  </script>
@{
    
    #region Database
    ICE.Vacations.DataBase.OracleDataClass oracle = new ICE.Vacations.DataBase.OracleDataClass();
   
    
    ICE.Vacations.DataBase.SQLDataClass sql = new ICE.Vacations.DataBase.SQLDataClass();
    ICE.Vacations.Request.Request request = new ICE.Vacations.Request.Request();
    ICE.Vacations.Helper.Services.Services.sendLog("Ejecuntado consulta a base de datos con usuario [" + User.Identity.Name.Split('\\')[1].ToString().ToLower() + "]", ICE.Vacations.Helper.Services.Services.errorType.InformationMessage);
    
    try
    {
        System.Data.SqlClient.SqlDataReader reader = sql.SearchEmployee(User.Identity.Name.Split('\\')[1].ToString().ToLower());
        
        if(reader.HasRows)
        {
            reader.Read();

            request.apellido1 = reader.GetValue(reader.GetOrdinal("APELLIDO1")).ToString();
            ICE.Vacations.Helper.Services.Services.sendLog("Apellido 1 [" + request.apellido1 + "]", ICE.Vacations.Helper.Services.Services.errorType.InformationMessage);
            request.username = User.Identity.Name.Split('\\')[1].ToString().ToLower();
            request.apellido2 = reader.GetValue(reader.GetOrdinal("APELLIDO2")).ToString();
            request.aprobador1 = reader.GetValue(reader.GetOrdinal("APROBADOR1")).ToString();
            request.aprobador2 = reader.GetValue(reader.GetOrdinal("APROBADOR2")).ToString();
            request.aprobador3 = reader.GetValue(reader.GetOrdinal("APROBADOR3")).ToString();
            request.employeeName = reader.GetValue(reader.GetOrdinal("NOMBRE")).ToString();
            request.eMail = reader.GetValue(reader.GetOrdinal("eMAIL")).ToString();
            
            request.employeeID = reader.GetValue(reader.GetOrdinal("CEDULA")).ToString();
            
            
            request.bossID = reader.GetValue(reader.GetOrdinal("CEDULA")).ToString();
            #region Oracle
            
            request.cod_cf = reader.GetValue(reader.GetOrdinal("CEDULA")).ToString();
            #endregion

        }else
        {
            ICE.Vacations.Helper.Services.Services.sendLog("No se encontraron resultados con el usuario [" + User.Identity.Name.Split('\\')[1].ToString().ToLower() + "]", ICE.Vacations.Helper.Services.Services.errorType.InformationMessage);
            
        }
    
    }catch (Exception exc)
    {
        ICE.Vacations.Helper.Services.Services.sendLog("ERROR No se encontraron resultados con el usuario [" + User.Identity.Name.Split('\\')[1].ToString().ToLower() + "]", ICE.Vacations.Helper.Services.Services.errorType.InformationMessage);

    }
    #endregion
    }

 

 
<div id="intro">
 <form name="cosa" action=@Url.Action("CrearSolicitud", "Home", "Home") method="POST" >
     
     <table style="vertical-align: central;" >

    <td width="120px">ID Solicitud:</td> <td width="225px">@Html.TextBox("requestID",@sql.getConsecutivo(), new { style="width:200px;",@readonly= "readonly" })</td> <tr style="height:50px;" />

    <td width="120px">Usuario:</td> <td width="225px">@Html.TextBox("user",@User.Identity.Name, new { style="width:200px;",@readonly= "readonly" })</td> <tr style="height:50px;" />

    <td width="120px">Cédula:</td> <td width="225px">@Html.TextBox("txtEmployeeID",@request.employeeID, new { style="width:400px;" })</td> <tr style="height:50px;" />

    <td width="120px">Primer Apellido:</td><td width="225px">@Html.TextBox("txtApellido1",@request.apellido1, new { style="width:400px;",@readonly= "readonly" })</td> <tr style="height:50px;" />

    <td width="120px">Segundo Apellido:</td> <td width="225px">@Html.TextBox("txtApellido2",@request.apellido2, new { style="width:400px;",@readonly= "readonly" }) </td><tr style="height:50px;" />

    <td width="120px">Nombre:</td> <td>@Html.TextBox("txtemployeeName",@request.employeeName, new { style="width:400px;",@readonly= "readonly" })</td> <tr style="height:50px;"/>

    <td width="120px">Email:</td> <td width="225px">@Html.TextBox("eMail",@request.eMail, new { style="width:200px;"})</td> <tr style="height:50px;"/>
    
    <td width="120px">CódigoCentro funcional:</td> <td width="25px"> @Html.TextBox("txtcodCF","", new { style="width:20px;" })   @Html.TextBox("txtcodDireccion","", new { style="width:50px;" }) </td>   <tr style="height:50px;"/>
    
    <td width="120px">Año:</td> <td width="225px">@Html.TextBox("year",@DateTime.Now.Year, new { style="width:50px;",@readonly= "readonly" })</td> <tr style="height:50px;"/>

    <td width="120px">Fecha:</td> <td>@Html.TextBox("txtDate",@DateTime.Now.ToString("MM/dd/yyyy"), new { style="width:200px;" , @readonly= "readonly"})</td>  <tr style="height:50px;"/>

    <td width="120px">Cantidad días disponibles:</td> <td width="225px">@Html.TextBox("totalAvailableDays","", new {style="width:500px;",@readonly= "readonly" })</td> <tr style="height:50px;"/>

    <td width="120px">Fecha Inicio:</td> <td width="225px">@Html.TextBox("txtDateFrom","", new { style="width:200px;" })</td> <tr style="height:50px;"/>

    <td width="120px">Fecha Fin:</td> <td width="225px">@Html.TextBox("txtDateTo","", new { style="width:200px;"})</td> <tr style="height:50px;"/>

    <td width="120px">Cantidad días solicitados:</td><td width="225px">@Html.TextBox("totalRequestedDays","", new { style="width:50px;",@readonly= "readonly" })</td> <tr style="height:50px;"/>

    <td width="120px">Comentarios:</td><td width="225px">@Html.TextArea("comments","", new { style="width:200px;"})</td> <tr style="height:100px;" />
    <td width="120px">Jefe:</td><td width="225px">@Html.TextBox("managerID",@request.aprobador1, new { style="width:200px;",@readonly= "readonly" })</td> <tr style="height:50px;"/>
    <td width="120px">Tipo:</td><td width="225px">@Html.TextBox("tipo",@sql.getTipoUsuario(request.username), new { style="width:200px;",@readonly= "readonly" })</td><tr style="height:50px;"/>
    
         </table>
        
                       
    <input type="submit" value="Guardar y Generar PDF" style="width:250px"/></br>

     
</form>
    </div>